<!DOCTYPE html>
<html th:replace="layout/layout"
      xmlns:th="http://www.thymeleaf.org">
<title th:fragment="titleName">用户管理</title>
<style th:fragment="styles">
</style>
<div id="customModule" th:fragment="content">
    <div class="row wrapper border-bottom white-bg page-heading">
        <div class="col-lg-10">
            <h2>人员管理</h2>
            <ol class="breadcrumb">
                <li>
                    <a href="/index?menuId=1">首页</a>
                </li>
                <li>
                    <a>系统管理</a>
                </li>
                <li class="active">
                    <strong>人员管理</strong>
                </li>
            </ol>
        </div>
        <div class="col-lg-2">

        </div>
    </div>

    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox ">
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-lg-3">
                                <div class="form-group">
                                    <select :disabled="city" id="cityCondition" name="cityCondition" v-model="cityCondition"
                                            autocomplete="off" class="form-control">
                                        <option value="-1">-- 地市 --</option>
                                        <option v-for="(item,index) in cityConditionList" :value="item.city_id">{{item.city_name}}</option>
                                    </select>
                                </div>
                            </div>

                            <div class="col-lg-3">
                                <div class="form-group">
                                    <select :disabled="district" id="districtCondition" name="districtCondition" v-model="districtCondition"
                                            autocomplete="off" class="form-control">
                                        <option value="-1">-- 区县 --</option>
                                        <option v-for="(item,index) in districtConditionList" :value="item.district_id">{{item.district_name}}</option>
                                    </select>
                                </div>
                            </div>

                            <div class="col-lg-3">
                                <div class="form-group">
                                    <select :disabled="town" id="townCondition" name="townCondition" v-model="townCondition"
                                            autocomplete="off" class="form-control">
                                        <option value="-1">-- 乡镇 --</option>
                                        <option v-for="(item,index) in townConditionList" :value="item.town_id">{{item.town__name}}</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-lg-3">
                                <div class="form-group">
                                    <input autocomplete="off" class="form-control" id="UserNameCondition"
                                           name="UserNameCondition"
                                           placeholder="用户名"
                                           type="text" v-model="UserNameCondition">
                                </div>
                            </div>

                            <div class="col-lg-2">
                                <div class="form-group">
                                    <select class="form-control" id='activityCondition' name='activityCondition'
                                            v-model="activityCondition">
                                        <option value="-1">--全部状态--</option>
                                        <option value="1">已激活</option>
                                        <option value="0">未激活</option>
                                    </select>
                                </div>
                            </div>
                            <div class="col-lg-2">
                                <button @click="search()" class="btn btn-primary  btn-rounded  btn-sm" id="search"
                                        type="submit"><i
                                        class="fa fa-search"></i>&nbsp;搜索
                                </button>
                                <button @click="reset()" class="btn btn-warning  btn-rounded  btn-sm" id="refresh"
                                        type="submit"><i
                                        class="fa fa-refresh"></i>&nbsp;重置
                                </button>
                            </div>
                        </div>
                        <div class="jqGrid_wrapper">
                            <div class="btn-group-sm" id="toolbar" role="group">
                                <a @click="addRecord();" class="btn btn-success" data-toggle="modal" v-if="isAdd"
                                   id="AddNew" name="AddNew">
                                    <i class="fa fa-plus"></i> 创建用户
                                </a>
                                <!--<a class="btn btn-primary single disabled">-->
                                <!--<i class="fa fa-edit"></i> 修改-->
                                <!--</a>-->
                                <!--<a class="btn btn-danger multiple disabled">-->
                                <!--<i class="fa fa-remove"></i> 删除-->
                                <!--</a>-->
                            </div>
                            <table class="table table-striped table-bordered table-hover " id="tableList">
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--模态框-->
    <div aria-hidden="true" class="modal inmodal" id="myModalAdd" role="dialog" tabindex="-1">
        <div class="modal-dialog  modal-lg">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal" type="button"><span
                            aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title">用户信息</h4>
                </div>
                <div class="modal-body">
                    <div class="tabs-container">
                        <ul class="nav nav-tabs" id="tabList">
                            <li class="active" id="tab1"><a data-toggle="tab" href="#tab-1"> 用户信息</a></li>
                        </ul>
                        <div class="tab-content">
                            <div class="tab-pane active" id="tab-1">
                                <div class="panel-body">
                                    <form class="form-horizontal" id="myform">
                                        <div class="row" id="deptContainer">
                                            <label class="col-lg-2 control-label"><font color="red">*</font>选择部门</label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <input id="treeId" v-model="deptId" name="deptId" type="hidden" autocomplete="off" class="form-control">
                                                    <input readonly id="treeName" name="deptName" v-model="deptName" type="text" autocomplete="off" class="form-control">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row" id="deptTreeContainer">
                                            <label class="col-lg-2 control-label"></label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <div id="tree" class="ztree treeselect"></div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row">
                                            <label class="col-lg-2 control-label"><font color="red">*</font>登录账号</label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <input autocomplete="off" class="form-control" id="userName"
                                                           maxlength="20" name="userName" placeholder="登录账号"
                                                           type="text" v-model="userName"/>
                                                </div>
                                            </div>
                                            <label class="col-lg-2 control-label"><font color="red">*</font>真实姓名</label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <input autocomplete="off" class="form-control" id="realName"
                                                           maxlength="20" name="realName" placeholder="真实姓名"
                                                           type="text" v-model="realName"/>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row" id="passwordContainer">
                                            <label class="col-lg-2 control-label"><font color="red">*</font>登录密码</label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <input type="password"  v-model="password"   id="password" name="password" placeholder="登录密码" autocomplete="off" class="form-control">
                                                </div>
                                            </div>
                                            <label class="col-lg-2 control-label"><font color="red">*</font>确认密码</label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <input type="password" v-model="passwordConfirm"  id="passwordConfirm" name="passwordConfirm" placeholder="确认密码" autocomplete="off" class="form-control">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row" id="phoneContainer">
                                            <label class="col-lg-2 control-label"><font color="red">*</font>联系电话</label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <input type="text" id="phone" v-model="phone" name="phone" placeholder="联系电话" autocomplete="off" class="form-control">
                                                </div>
                                            </div>
                                            <label class="col-lg-2 control-label"><font color="red">*</font>身份证号</label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <input type="text" id="idCard" v-model="idCard"  name="idCard" placeholder="身份证号" autocomplete="off" class="form-control">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row"  id="mailContainer">
                                            <label class="col-lg-2 control-label">邮箱</label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <input autocomplete="off" class="form-control"
                                                           maxlength="50" placeholder="邮箱" type="text"
                                                           v-model="email">
                                                </div>
                                            </div>
                                            <label class="col-lg-2 control-label"><font color="red">*</font>所属角色</label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <select class="form-control" v-model="roleID" name="roleID">
                                                        <option :value="item.id" v-for="(item,index) in roleList">
                                                            {{item.name}}
                                                        </option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row"  id="preContainer">
                                            <label class="col-lg-2 control-label"><font color="red">*</font>区域权限</label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <select :disabled="city"  v-model="authCity"  id='authCity' name='authCity' class="form-control" placeholder="城市编码" @change="loadDistricts()">
                                                        <option :value="item.city_id" v-for="(item,index) in cityList">
                                                            {{item.city_name}}
                                                        </option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="col-lg-2 col-lg-offset-1">
                                                <div class="form-group">
                                                    <select :disabled="district" v-model="authDistrict" id='authDistrict'  name='authDistrict' class="form-control" placeholder="区县编码" @change="loadTowns()">
                                                        <option :value="0">
                                                            请选择
                                                        </option>
                                                        <option :value="item.district_id" v-for="(item,index) in districtList">
                                                            {{item.district_name}}
                                                        </option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="col-lg-2 col-lg-offset-1">
                                                <div class="form-group">
                                                    <select :disabled="town"  v-model="authTown" id='authTown'  name='authTown' class="form-control" placeholder="乡镇编码">
                                                        <option :value="0">
                                                            请选择
                                                        </option>
                                                        <option :value="item.town_id" v-for="(item,index) in townList">
                                                            {{item.town__name}}
                                                        </option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="row"  id="statusContainer">
                                            <label class="col-lg-2 control-label">状态</label>
                                            <div class="col-lg-4">
                                                <div class="form-group">
                                                    <select class="form-control" id='activity' name='activity'
                                                            v-model="activity">
                                                        <option value="1">启用</option>
                                                        <option value="0">停用</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button @click="saveRecord();" class="btn btn-success" id="save" name="save" type="button"
                            v-if="clickState=='edit'||clickState=='add'||clickState=='resetPwd'"><i
                            class="fa fa-save"></i>&nbsp;提交
                    </button>
                    <button class="btn btn-danger" data-dismiss="modal" id="close" name="close" type="button"><i
                            class="fa fa-close"></i>&nbsp;关 闭
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:fragment="scriptRef">
    <script th:src="@{/js/lib/validate/jquery.validate.min.js}"></script>
    <script th:src="@{/js/user/User.js}"></script>
</div>

<script th:fragment="scripts" type="text/javascript">
    User.init();
    $('.i-checks').iCheck({
        checkboxClass: 'icheckbox_square-green',
        radioClass: 'iradio_square-green',
    });
</script>
</html>
